﻿using System.Data.Entity;

namespace HobSoft.SoccerBet2014.Domain.Models.DbContext
{
    using DbSchema;
    public class BFDbContext : System.Data.Entity.DbContext
    {
        public BFDbContext()
            : base("BFDbContext")
        {
            this.Configuration.LazyLoadingEnabled = false;
        }

        public BFDbContext(string connStringName)
            : base(connStringName)
        {

        }

        public IDbSet<BFAccount> AccountSet { get; set; }

        public IDbSet<BFEvent> EventSet { get; set; }
        public IDbSet<BFMarket> MarketSet { get; set; }
        public IDbSet<BFRunner> RunnerSet { get; set; }
        public IDbSet<BFMarketCategory> CaregorySet { get; set; }
        public IDbSet<GameMapping> GameMappingSet { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<System.Data.Entity.Infrastructure.IncludeMetadataConvention>();
            base.OnModelCreating(modelBuilder);
            modelBuilder.Configurations.Add(new BFAccountConfiguation());
            modelBuilder.Configurations.Add(new BFEventConfiguration());
            modelBuilder.Configurations.Add(new BFMarketConfiguration());
            modelBuilder.Configurations.Add(new BFRunnerConfiguration());
            modelBuilder.Configurations.Add(new BFCategoryConfiguration());
            modelBuilder.Configurations.Add(new GameMappingConfiguration());
        }
    }
}
